<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Stock Screener</title>
<%@include file="../common_imports.jsp"%>
<script type="text/javascript">
	var strings = new Array();
	strings['recaptcha.instructions_visual'] = "<spring:message code='recaptcha.instructions_visual' javaScriptEscape='true'/>";
	strings['recaptcha.instructions_audio'] = "<spring:message code='recaptcha.instructions_audio' javaScriptEscape='true'/>";
	strings['recaptcha.play_again'] = "<spring:message code='recaptcha.play_again' javaScriptEscape='true'/>";
	strings['recaptcha.cant_hear_this'] = "<spring:message code='recaptcha.cant_hear_this' javaScriptEscape='true'/>";
	strings['recaptcha.visual_challenge'] = "<spring:message code='recaptcha.visual_challenge' javaScriptEscape='true'/>";
	strings['recaptcha.audio_challenge'] = "<spring:message code='recaptcha.audio_challenge' javaScriptEscape='true'/>";
	strings['recaptcha.refresh_btn'] = "<spring:message code='recaptcha.refresh_btn' javaScriptEscape='true'/>";
	strings['recaptcha.help_btn'] = "<spring:message code='recaptcha.help_btn' javaScriptEscape='true'/>";
	strings['recaptcha.incorrect_try_again'] = "<spring:message code='recaptcha.incorrect_try_again' javaScriptEscape='true'/>";

	var RecaptchaOptions = {
		custom_translations : {
			instructions_visual : strings['recaptcha.instructions_visual'],
			instructions_audio : strings['recaptcha.instructions_audio'],
			play_again : strings['recaptcha.play_again'],
			cant_hear_this : strings['recaptcha.cant_hear_this'],
			visual_challenge : strings['recaptcha.visual_challenge'],
			audio_challenge : strings['recaptcha.audio_challenge'],
			refresh_btn : strings['recaptcha.refresh_btn'],
			help_btn : strings['recaptcha.help_btn'],
			incorrect_try_again : strings['recaptcha.incorrect_try_again']
		},
		theme : 'clean'
	};
</script>
</head>
<body>
	<div class="main_wrapper">
		<div class="container-fluid">
			<div class="row-fluid">
				<%@include file="../stockscreener/header.jsp"%>
			</div>
			<div class="row-fluid">
				<div class="main_menu_wrapper span12">
					<div class="navbar">
						<div class="navbar-inner">
							<div class="container">
								<button class="btn btn-navbar collapsed"
									data-target=".nav-collapse" data-toggle="collapse"
									type="button">
									<div class="icon_wrapper"
										style="float: right; padding: 5px 10px;">
										<span class="icon-bar"></span> <span class="icon-bar"></span>
										<span class="icon-bar"></span>
									</div>
								</button>

								<div class="nav-collapse collapse">
									<%@include file="../header_link.jsp"%>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="row-fluid">
				<form:form method="POST" commandName="user"
					action="${pageContext.request.contextPath}/user/add/process.html"
					class="form-horizontal">
					<div>
						<div>${message}</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">User Name</label>
							<div class="controls">
								<form:input path="userName" />
							</div>
							<div class="controls">
								<form:errors path="userName" cssClass="error"></form:errors>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Password :</label>
							<div class="controls">
								<form:password path="password" />
							</div>
							<div class="controls">
								<form:errors path="password" cssClass="error"></form:errors>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Email :</label>
							<div class="controls">
								<form:input path="email" />
							</div>
							<div class="controls">
								<form:errors path="email" cssClass="error"></form:errors>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Telephone :</label>
							<div class="controls">
								<form:input path="telephone" />
							</div>
							<div class="controls">
								<form:errors path="telephone" cssClass="error"></form:errors>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="inputEmail">Address :</label>
							<div class="controls">
								<form:textarea path="address" />
							</div>
						</div>

						<div id="captcha_paragraph">
							<c:if test="${invalidRecaptcha == true}">
								<span class="error_form_validation">type here</span>
							</c:if>
							<%
								ReCaptcha c = ReCaptchaFactory.newReCaptcha(
											"6LcW3OASAAAAAKEJTHMmp_bo5kny4lZXeDtgcMqC",
											"6LcW3OASAAAAAKVX2duVsSy2uMMHL105-jPDrHMD", false);
									out.print(c.createRecaptchaHtml(null, null));
							%>
						</div>
						<div>${messageRecaptcha}</div>
						<input class="btn btn-inverse save" type="submit" value="Save" />
					</div>
				</form:form>
			</div>
			<div class="footer_wrapper">
				<%@include file="../footer.jsp"%>
			</div>
		</div>
	</div>
</body>
</html>
